package com.baizhi.luoht.serviceimpl;/**
 * @Author:luoht
 * @Description：
 * @Date：Create in 21:24 2018/10/24
 */

import com.baizhi.luoht.dao.UserDAO;
import com.baizhi.luoht.entity.User;
import com.baizhi.luoht.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @program: ems
 * @description:
 * @author: luoht
 * @create: 2018-10-24 21:24
 **/
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDAO userDAO;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
    public User showUser(String username, String password) {
        User user = userDAO.getUser(username);
        if (user.getPassword().equals(password)){
            return user;
        }
        return null;
    }

    public UserDAO getUserDAO() {
        return userDAO;
    }

    public void setUserDAO(UserDAO userDAO) {
        this.userDAO = userDAO;
    }
}
